﻿#ifndef _SOCKETFD_H
#define _SOCKETFD_H

#include "socketlibtypes.h"

namespace SocketLib
{

class SocketFD
{
public:
    SocketFD();
    virtual         ~SocketFD();

    void            setSocketFD(sock aFD);
    sock            getSocketFD();
    void            setNoBlock(bool aMode);
    bool            isValid();

    virtual void    init();

    virtual void    disSocket()     {}
    virtual void    onConnection()  {}
    virtual void    onClose()       {}
    virtual bool    onRead()        {   return true;    }
    virtual bool    onSend()        {   return true;    }

protected:
    sock            m_fd;
    bool            m_isblocking;

private:
    void            _init();
};

}

#endif
